package cn.iocoder.yudao.module.biz.dal.mysql.licenceAnalyzeData;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.biz.controller.admin.licenceAnalyzeData.vo.BizLicenceAnalyzeDataExportReqVO;
import cn.iocoder.yudao.module.biz.controller.admin.licenceAnalyzeData.vo.BizLicenceAnalyzeDataPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.licenceAnalyzeData.BizLicenceAnalyzeDataDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 危险作业票分析数据 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizLicenceAnalyzeDataMapper extends BaseMapperX<BizLicenceAnalyzeDataDO> {

    default PageResult<BizLicenceAnalyzeDataDO> selectPage(BizLicenceAnalyzeDataPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizLicenceAnalyzeDataDO>()
                .eqIfPresent(BizLicenceAnalyzeDataDO::getLicenceId, reqVO.getLicenceId())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getLicenceType, reqVO.getLicenceType())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getAnalyzePoint, reqVO.getAnalyzePoint())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getAnalyzeData, reqVO.getAnalyzeData())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getAnalyst, reqVO.getAnalyst())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getCombustible, reqVO.getCombustible())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getPhoto, reqVO.getPhoto())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getOxygen, reqVO.getOxygen())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getCarbonMonoxide, reqVO.getCarbonMonoxide())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getToxicGas, reqVO.getToxicGas())
                .betweenIfPresent(BizLicenceAnalyzeDataDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizLicenceAnalyzeDataDO::getId));
    }

    default List<BizLicenceAnalyzeDataDO> selectList(BizLicenceAnalyzeDataExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizLicenceAnalyzeDataDO>()
                .eqIfPresent(BizLicenceAnalyzeDataDO::getLicenceId, reqVO.getLicenceId())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getLicenceType, reqVO.getLicenceType())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getAnalyzePoint, reqVO.getAnalyzePoint())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getAnalyzeData, reqVO.getAnalyzeData())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getAnalyst, reqVO.getAnalyst())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getCombustible, reqVO.getCombustible())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getPhoto, reqVO.getPhoto())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getOxygen, reqVO.getOxygen())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getCarbonMonoxide, reqVO.getCarbonMonoxide())
                .eqIfPresent(BizLicenceAnalyzeDataDO::getToxicGas, reqVO.getToxicGas())
                .betweenIfPresent(BizLicenceAnalyzeDataDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizLicenceAnalyzeDataDO::getId));
    }

    default List<BizLicenceAnalyzeDataDO> selectListInLicenceIds(List<String> licenceIds){
        return selectList(new LambdaQueryWrapperX<BizLicenceAnalyzeDataDO>()
                .in(BizLicenceAnalyzeDataDO::getLicenceId,licenceIds));
    }

}
